package com.sj.parksdk.utils.bdlocation;

import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;

public class OnBDLocationListener extends BDAbstractLocationListener {
    private OnLocationListener mOnLocationListener;

    public OnBDLocationListener setOnLocationListener(OnLocationListener onLocationListener) {
        mOnLocationListener = onLocationListener;
        return this;
    }

    @Override
    public void onReceiveLocation(BDLocation bdLocation) {
        if (mOnLocationListener != null) {
            mOnLocationListener.onLocationChanged(LocationService.onReceiveLocation(bdLocation), LocationUtils.isValidBDLocation(bdLocation)?LocateState.SUCCESS:LocateState.FAILURE);
//            LocationService.get().unregisterListener(this);
        }
    }
}
